﻿using AutoMapper;
using WeatherHistory.Api.CommandsQueries.Mapping;
using WeatherHistory.Data.Entities;

namespace WeatherHistory.Api.CommandsQueries.Queries.Accounts.Search;

public class SearchAccountsQueryAccountDto : IMapWith<Account>
{
    public long Id { get; init; }
    public string FirstName { get; init; } = null!;
    public string LastName { get; init; } = null!;
    public string Email { get; init; } = null!;

    public void Mapping(Profile profile)
    {
        profile.CreateMap<Account, SearchAccountsQueryAccountDto>()
            .ForMember(dest => dest.Id,
                opt => opt.MapFrom(src => src.Id))
            .ForMember(dest => dest.FirstName,
                opt => opt.MapFrom(src => src.FirstName))
            .ForMember(dest => dest.LastName,
                opt => opt.MapFrom(src => src.LastName))
            .ForMember(dest => dest.Email,
                opt => opt.MapFrom(src => src.Email));
    }
}